#include <iostream>
using namespace std;
int m1,m2,n,ans,k;
int main(){
	cin>>m1>>n;m2=m1;
	while(m2<n){
        m2=m2*2+1;
        m1*=2;
        if(m2<=n)ans+=m2-m1+1;
        else if(m2>n&&m1<=n){
            ans+=n-m1+1;
            break;
        } 
    }
    cout<<++ans<<endl;
    return 0;
}
